package com.xhs.zdl.demo.zxing;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.xhs.zdl.demo.MyUtils;
import com.xhs.zdl.demo.R;

public class CommitActivity extends AppCompatActivity {

    private TextView tv_value;
    private Button commit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_commit);

        findView();
        initView();
    }

    private void initView() {
        String result = getIntent().getStringExtra("result");
        tv_value.setText(result);

        commit.setOnClickListener(onClickListener);
    }

    /**
     * 拿到控件
     */
    private void findView() {
        tv_value = (TextView) findViewById(R.id.tv_value);
        commit = (Button) findViewById(R.id.commit);
    }

    /**
     * 点击事件
     */
    View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            switch (view.getId()){
                case R.id.commit:
                    Commit();
                    break;
            }
        }
    };

    /**
     * 注册
     */
    private void Commit(){
        MyUtils.Toast(this, "注册成功，跳转到首页...");
        finish();
    }
}
